<?php
/*==========================================================================*\
| AGRIVIET - CONTENT MANAGERMENT SYSTEM						
\*==========================================================================*/

function generate_name($prefix,$id,$filename)
{
	$ext = substr($filename,strlen($filename) - 4,4);
	return $prefix . $id . $ext;
}

function check_upload_extension($filename,$allow_list){
	
	$sExtension = substr( $filename, ( strrpos($filename, '.') + 1 ) ) ;
	$sExtension = strtolower( $sExtension ) ;
	
	$allow_arr = explode(",",$allow_list);
	$pass = 0;
	
	for ($i=0;$i<count($allow_arr);$i++){
		if ($sExtension == $allow_arr[$i]) $pass = 1;
	}
	return $pass;
}
?>